window.departmentAPI = {
    // 获取部门列表
    getDepartments: async (params = {}) => {
        try {
            const response = await apiClient.get('/api/departments/', { params });
            return response;
        } catch (error) {
            console.error('获取部门列表失败:', error);
            throw error;
        }
    },


    // 创建部门
    createDepartment: async (departmentData) => {
        try {
            const response = await apiClient.post('/api/departments/', departmentData);
            return response;
        } catch (error) {
            console.error('创建部门失败:', error);
            throw error;
        }
    },

    // 更新部门信息
    updateDepartment: async (id, departmentData) => {
        try {
            const response = await apiClient.put(`/api/departments/${id}`, departmentData);
            return response;
        } catch (error) {
            console.error('更新部门信息失败:', error);
            throw error;
        }
    },

    // 删除部门
    deleteDepartment: async (id) => {
        try {
            const response = await apiClient.delete(`/api/departments/${id}`);
            return response;
        } catch (error) {
            console.error('删除部门失败:', error);
            throw error;
        }
    },

};